package com.knightsoft.kgui;

import java.awt.Toolkit;
import javax.swing.JFrame;

@SuppressWarnings("serial")
public class CenterFrame extends JFrame {

	/**
	 * @version: beta
	 */
	public void setLocation(int width, int height) {
		int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
		int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
		
		super.setLocation( (screenWidth - width )   / 2,
				     	   (screenHeight - height ) / 2);
		
	}
	
	public void setSize(int width, int height) {
		super.setSize(width, height);
	}
	
	public static void main(String[] args) {
		CenterFrame frm = new CenterFrame();
		
		frm.setSize(400, 300);
		frm.setLocation(400, 300);
		frm.setVisible(true);
	}

}
